package com.blockmeta.bbs.baselibrary.base.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by author on 2017/12/26.
 * 需要动态创建Fragment
 * 0.1的位置是固定的  标示有自选和排行
 * 之前Fragment是通过 币种和交易所进行创建的
 */

public class BaseTabViewPagerAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> fragments;
    private List<String> tabtitle;

    public BaseTabViewPagerAdapter(FragmentManager fm, List<Fragment> fragments, List<String> tabtitle) {
        super(fm);
        this.fragments = fragments;
        this.tabtitle = tabtitle;
    }



    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return tabtitle.size();
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return tabtitle.get(position % tabtitle.size());
    }
}
